﻿
@{
    Layout = null;
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Topro</title>
    <meta name="description" content="">
    <link href="/css/bootstrap.css" rel="stylesheet" />
    <link href="/css/login.css" rel="stylesheet">
    <script src="/lib/jquery/jquery.1.10.2.min.js"></script>
    <script src="/lib/jquery/jquery.serializejson.min.js"></script>
    <script src="/lib/dialog/dialog.yui.js"></script>
    <script src="/js/base.min.js"></script>
    <script src="/js/ui.min.js"></script>
    <link href="~/css/login1.css" rel="stylesheet" />
</head>
<body>
    <!--login-wrap start-->
    <div class="container">

        <div class="row" id="pwd-container">
            <div class="col-md-4"></div>

            <div class="col-md-4">
                <section class="login-form">
                    <form id="form" onclick="return false" role="login">
                        <input type="text" name="account" placeholder="用户名" required class="form-control input-lg" autocomplete="off" />

                        <input type="password" class="form-control input-lg" name="password" placeholder="密码" required=""  autocomplete="off"/>


                        <div class="pwstrength_viewport_progress"></div>


                        <a class="btn btn-lg btn-primary btn-block" id="login_btn" onclick="return login()">登&nbsp;录</a>
                        <div>
                            @*<a href="#">Create account</a> or <a href="#">reset password</a>*@
                        </div>

                    </form>
                    @*<div class="form-links">
                        <a href="#">www.website.com</a>
                    </div>*@
                </section>
            </div>

            <div class="col-md-4"></div>
        </div>

    </div>
    <!--login-wrap end-->
    <script type="text/javascript">
        $("body").keydown(function (event) {
            if (event.keyCode == "13") {
                var account = $("input[name='account']").val();
                var password = $("input[name='password']").val();
                if (account != "" && password != "") {
                    $("#login_btn").click();
                }
            }
        });  

        function login() {

            var cover = Topro.UI.Mask({
                obj: $("body"),
                opacity: 0.5
            });

            var data = $("#form").serializeJSON();

            $.post("/Account/Login", data, function (res) {
                if (res.success) {
                    Topro.UI.Tip_success("登录成功！");

                    setTimeout(function () {
                        window.location.href = "/Home/Index";
                    }, 500)

                } else {
                    Topro.UI.Tip_danger(res.message);
                }
                cover.Remove();
            });
        }
    </script>
</body>
</html>